import request from "@/utils/requestMock";
//初始接口之一
//https://www.dance365.com/apis/moment/properties/filter/vip_zone?access_token=c494ae44-3adc-48ca-8749-5128a53358d7
//之二
//https://www.dance365.com/apis/moment/moments/collect/vip_zone/integrated?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&pageSize=20&pageNum=0
//access_token:
// c494ae44-3adc-48ca-8749-5128a53358d7
// pageSize:
// 20
// pageNum:
// 0
export interface zoneList{
    choises:choise[],
    formType:string,
    label:string,
    name:string,
    style:string,
    valueType:string
}
export interface choise{
    id:string,
    name:string
}

export interface pageList{
    content:content[],
    first:boolean,
    last:boolean,
    number:number,
    numberOfElements:number,
    offset:null,
    size:number,
    sort:null,
    statistics:statistic
    totalElements:number,
    totalPages:number,
    useOffset:boolean
}
interface statistic{
    minScore:null,
    totalDiscountCourse:number,
    totalVipPrivilegeCount:number
}

export interface content{
    activityTotalDays:number,
    aiyigeApplication:string,
    algorithmSortValue:number,
    avocationTags:avocationTag[],
    channel:string,
    cityId:string,
    cityName:string,
    commodityBackup:{
        originPrice:string,
        price:string,
        showLinePrice:boolean
        unitPrice:string
    },
    cover:string[],
    createTime:number,
    creator:string,
    creatorBackup:{
        avatar:string,
        certificationType:string,
        id:string,
        level:number,
        name:string,
        type:string,
        vipExpireTime:number,
        vipGrade:number
    }
    difficultDegreeValue:number,
    editHighestVersion:string,
    enclosureCount:number,
    favorableValue:number,
    id:string,
    initExposureNum:number,
    inventoryBackup:{
        availableInventory:number,
        lockedInventory:number,
        orderOccupiedInventory:number,
        selledInventory:number,
        total:number,
        virtualInventory:number,
    },
    maxP:number,
    mediaSummary:{
        count:number,
        duration:number
    },
    momentClassificationBackup:{
        classification:string,
        workTitle:string
    },
    momentId:string,
    moreBackup:{
        actualPrice:string,
        allowExtractAudio:number,
        courseTypeTags:courseTypeTag[],
        difficultDegree:{
            id:number,
            name:string
        },
        divisionProportion:string,
        iosDivisionProportion:string,
        learningGoalsTags:learningGoalsTag[],
        originPrice:string,
        otherDivisionProportion:string,
        platformVipPlan:number,
        price:number,
        suitablePopulationTags:courseTypeTag[],
        teacher:string,
        totalDuration:number,
        videoCount:number,
        videos:video[]
    },
    needPromotion:number,
    notVipPromotion:number,
    num:number,
    onSalesBackup:{
        createTime:number,
        effectSync:number,
        endTime:number,
        id:string,
        momentId:string,
        price:number,
        startTime:number,
        unEffectSync:boolean,
        updateTime:number,
        userId:string
    },
    onsellTime:number,
    onsellUpdateTime:number,
    otherTags:otherTag[],
    popTrainingIndex:number,
    recDegree:number,
    receiptsAmountCapacity:number,
    recentFavorableValue:number,
    router:string,
    statisticsBackup:{
        actualSellCount:number,
        commentCount:number,
        enquiryCount:number,
        exposureCount:number,
        favoriteCount:number,
        liveStatus:number,
        lockCount:number,
        playBackDuration:number,
        praiseCount:number,
        requireAccessoryCount:number,
        requireLiveCourseCount:number,
        requireMajorCourseCount:number,
        requireMusicCount:number,
        requireVideoCourseCount:number,
        reviewCount:number,
        sellAmount:number,
        sellCount:number,
        shareAmount:string,
        shareCount:number,
        signupCount:number,
        studentCount:number,
        userCacheCount:number,
        viewCount:number
    },
    status:string,
    subject:string,
    tags:avocationTag[],
    title:string,
    updateTime:number,
    version:number,
    vipPromotion:number,
    vipTag:{
        createTime:number,
        groupType:string,
        priority:number,
        updateTime:number
    }
}
interface avocationTag{
    id:string,
    label:string,
    name:string
}
interface courseTypeTag{
    groupType:string,
    id:string
    label:string,
    name:string
}
interface learningGoalsTag{
    groupType:string,
    id:string,
    label:string,
    name:string
}
interface video{
    cover:string,
    duration:number,
    free:number,
    hisUrl:string,
    originUrl:string,
    size:number,
    sortNum:number,
    title:string,
    url:string
}
interface otherTag{
    groupType:string,
    id:string
}

interface pageType{
    path?:string,
    pageSize:number,
    pageNum:number,
    data?:object,
    sort?:string
}
export interface theme{
    content:TheContent[],
    first:boolean,
    last:boolean,
    number:number,
    numberOfElements:number,
    offset: null,
    size:number,
    sort:null,
    statistics:null,
    totalElements:number,
    totalPages:number,
    useOffset:number
}
export interface TheContent{
    cover:string,
    id:string,
    name:string,
    onsellTime:number,
    remark:string,
    updateTime:number,
    webUrl:string
}
export default {
    getInit(path:string){
        return request.get<any,zoneList[]>(`/moment/properties/filter${path}?access_token=c494ae44-3adc-48ca-8749-5128a53358d7`)
    },
    getPage({path, pageSize, pageNum, data={}, sort='integrated'}:pageType){
        return request.post<any,pageList>(`/moment/moments/collect${path}/${sort}?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&pageSize=${pageSize}&pageNum=${pageNum}`,data)
    },
    getTheme(pageSize=16){
        return request.get<any,theme>(`/moment/activityZones/collect/default?access_token=c494ae44-3adc-48ca-8749-5128a53358d7&pageSize=${pageSize}`)
    }
}